package com.choupin.choupin.controller;

import com.choupin.choupin.entity.JsonResult;
import com.choupin.choupin.entity.Member;
import com.choupin.choupin.service.IMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@SuppressWarnings("ALL")
@CrossOrigin
@RestController
@RequestMapping("/member")
public class MemberController extends BaseController {

    @Autowired
    IMemberService memberService;

    @CrossOrigin
    @PostMapping("/showmember")
    public JsonResult<List<Member>> showMember(){
        JsonResult<List<Member>> jsonResult=new JsonResult<>();
        List<Member> member=memberService.showMember();
        System.out.println("完成获取会员数据！");
        jsonResult.setState(SUCCESS);
        jsonResult.setData(member);
        return jsonResult;
    }

}
